'\" t
.\"     Title: CREATE ACCESS METHOD
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 2021
.\"    Manual: PostgreSQL 13.3 Documentation
.\"    Source: PostgreSQL 13.3
.\"  Language: English
.\"
.TH "CREATE ACCESS METHOD" "7" "2021" "PostgreSQL 13.3" "PostgreSQL 13.3 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
CREATE_ACCESS_METHOD \- define a new access method
.SH "SYNOPSIS"
.sp
.nf
CREATE ACCESS METHOD \fIname\fR
    TYPE \fIaccess_method_type\fR
    HANDLER \fIhandler_function\fR
.fi
.SH "DESCRIPTION"
.PP
\fBCREATE ACCESS METHOD\fR
creates a new access method\&.
.PP
The access method name must be unique within the database\&.
.PP
Only superusers can define new access methods\&.
.SH "PARAMETERS"
.PP
\fIname\fR
.RS 4
The name of the access method to be created\&.
.RE
.PP
\fIaccess_method_type\fR
.RS 4
This clause specifies the type of access method to define\&. Only
TABLE
and
INDEX
are supported at present\&.
.RE
.PP
\fIhandler_function\fR
.RS 4
\fIhandler_function\fR
is the name (possibly schema\-qualified) of a previously registered function that represents the access method\&. The handler function must be declared to take a single argument of type
internal, and its return type depends on the type of access method; for
TABLE
access methods, it must be
table_am_handler
and for
INDEX
access methods, it must be
index_am_handler\&. The C\-level API that the handler function must implement varies depending on the type of access method\&. The table access method API is described in
Chapter\ \&60
and the index access method API is described in
Chapter\ \&61\&.
.RE
.SH "EXAMPLES"
.PP
Create an index access method
heptree
with handler function
heptree_handler:
.sp
.if n \{\
.RS 4
.\}
.nf
CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
.fi
.if n \{\
.RE
.\}
.SH "COMPATIBILITY"
.PP
\fBCREATE ACCESS METHOD\fR
is a
PostgreSQL
extension\&.
.SH "SEE ALSO"
DROP ACCESS METHOD (\fBDROP_ACCESS_METHOD\fR(7)), CREATE OPERATOR CLASS (\fBCREATE_OPERATOR_CLASS\fR(7)), CREATE OPERATOR FAMILY (\fBCREATE_OPERATOR_FAMILY\fR(7))
